﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using IPluginInterface;

namespace DemoSailHeroPlugin
{
    public class WaterPlatForm : IMessageReturn
    {

        private string url = ConfigOprater.GetNodeValue("WebserviceUrl");
        private WebServiceHelper whelper = new WebServiceHelper();
        /// <summary>
        /// 接收到现场机返回消息时触发
        /// </summary>
        /// <param name="msg">消息对象</param>
        public void OnMessageRecived(MessageModel msg)
        {
            return;
        }

        /// <summary>
        /// 接收到离线消息回执时触发
        /// </summary>
        /// <param name="msg">离线消息内容</param>
        public void OnOffLineMessageRecived(MessageModel msg)
        {
            return;
        }

        /// <summary>
        /// 接收到离线消息回执时触发
        /// </summary>
        /// <param name="smstitle">标题：默认是“仪器反控”</param>
        /// <param name="smscontent">内容</param>
        /// <param name="userid">用户ID</param>
        public void OnOffLineMessageRecived(string smstitle, string smscontent, string userid)
        {
            string methodName = "InsertSMS";
            whelper.InvokeWebService(url, methodName, new object[] { smstitle, smscontent, userid });
        }

        /// <summary>
        /// 实时数据接收到的触发事件
        /// </summary>
        /// <param name="msg">实时数据</param>
        public void OnRunTimeMessageRecived(MessageModel msg)
        {
            return;
        }

        /// <summary>
        /// 分钟，小时，天历史数据
        /// </summary>
        /// <param name="msg">历史数据</param>
        public void OnHistoryMessageRecived(MessageModel msg)
        {
            return;
        }

        /// <summary>
        /// 报警事件
        /// </summary>
        /// <param name="msg">报警的数据</param>
        public void OnAlertDesired(MessageModel msg)
        {
            return;
        }
    }
}
